"""
@version:python3
@author:ll
@file:04-QWidget-窗口相关的操作.py
@time:2022/2/11 21:59
"""
# 0、导入需要的包和模块
from PyQt5.Qt import *
import sys

class Window(QWidget):
    def mousePressEvent(self, evt):
        if window.isMaximized():
            self.showNormal()
        else:
            self.showMaximized()

# 1、创建一个应用程序对象
app = QApplication(sys.argv)

# 2、控件操作
# 创建控件、设置控件、事件和信号的处理
# 2.1 创建控件
window = Window()
# 2.2 设置控件
# window.setWindowTitle("社会我顺哥")
# icon = QIcon("xxx.png")
# window.setWindowIcon(icon)
# print(window.windowIcon()) # 可以获得图标对象

# window.setWindowOpacity(0.5)
# print(window.windowOpacity())
# print(window.windowState() == Qt.WindowNoState)

# window.setWindowState(Qt.WindowMinimized)
# window.setWindowState(Qt.WindowMaximized)
# window.setWindowState(Qt.WindowFullScreen)

# w2 = QWidget()
# w2.setWindowTitle("w2")
# w2.show()

window.resize(500,500)

# 2.3 展示控件
window.show()

# window.showMaximized()
# window.showMinimized()
# window.showFullScreen()


# window.setWindowState(Qt.WindowActive)

# 3、应用程序的执行，进入到消息循环
sys.exit(app.exec_())